package cn.com.header.web.service.sys;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.com.header.web.model.sys.Attachment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;


@Service
public interface AttachService {
	void writeAndSave(Attachment attach, InputStream input,HttpServletRequest request);


	void writeFile(Attachment attach, InputStream input,HttpServletRequest request);
	
	/**
	 * Web版生成附件的保存路径，不包含根路径。 文件的保存路径格式为：根 + 类型 + 年份 + 时间串 + 文件后缀
	 */
	String generateFileSavePath(String rootPath, String origName, Attachment.Type attachType);


	public Attachment loadAttach(Long id);


	/**
	 * 获取指定附件对应的文件输入流
	 */
	 InputStream getFileInputStream(Long attachId,HttpServletRequest request) throws Exception;



}
